-
Notifications
You must be signed in to change notification settings - Fork 132
Enable guest debugging for HyperV on windows #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Nice. Any chance we could land this after #469? :P |
Yes, I was thinking on doing that to be less work for solving conflicts |
9afdaba
to
c5caf69
Compare
- Previously, interrupting a running vCPU under debug meant directly sending a SIGINT signal, since we have a way to handle interrupt sending, there is no need to do that. Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
c5caf69
to
bde9c7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, One small comment, lets get @ludfjig to review this one last time before we merge
@@ -90,7 +90,7 @@ fn main() -> Result<()> { | |||
// Essentially the kvm and mshv features are ignored on windows as long as you use #[cfg(kvm)] and not #[cfg(feature = "kvm")]. | |||
// You should never use #[cfg(feature = "kvm")] or #[cfg(feature = "mshv")] in the codebase. | |||
cfg_aliases::cfg_aliases! { | |||
gdb: { all(feature = "gdb", debug_assertions, any(feature = "kvm", feature = "mshv2", feature = "mshv3"), target_os = "linux") }, | |||
gdb: { all(feature = "gdb", debug_assertions, any(feature = "kvm", feature = "mshv2", feature = "mshv3")) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need any(feature = "kvm", feature = "mshv2", feature = "mshv3")
since its now enabled for all hypervisors?
Description
This closes #241
This brings the same debugging behavior to windows guests as kvm and mshv guests have on linux.
Some of the duplicated debug logic that is implemented on each hypervisor driver will be refactored later in a single implementation.
Copilot Generated Description
This pull request introduces significant updates to the Hyperlight debugging functionality, expanding support to Windows environments, refactoring the codebase to improve modularity, and enhancing the debugging capabilities. The most important changes include adding Windows-specific signal handling, introducing the
HypervDebug
struct for Hyper-V guest debugging, and removing Linux-specific dependencies from cross-platform code.Cross-platform debugging enhancements:
src/hyperlight_host/src/hypervisor/gdb/event_loop.rs
: Added conditional compilation for signal handling to differentiate between Linux (libc::SIGINT
,libc::SIGSEGV
) and Windows (SIGINT
,SIGSEGV
). Updated signal handling logic to use platform-specific signals. [1] [2]src/hyperlight_host/build.rs
: Removed Linux-specific constraints from thegdb
feature configuration, allowing debugging on Windows.Windows debugging support:
src/hyperlight_host/src/hypervisor/gdb/hyperv_debug.rs
: Added theHypervDebug
struct to implement debugging functionalities for Hyper-V guests, including hardware and software breakpoints, register manipulation, and vCPU stop reason handling.src/hyperlight_host/src/hypervisor/gdb/mod.rs
: IntegratedHypervDebug
into the debugging module and updated theGuestDebug
trait visibility topub(super)
for better encapsulation. [1] [2] [3]Refactoring for improved modularity:
src/hyperlight_host/src/hypervisor/gdb/x86_64_target.rs
: Replaced the thread ID with anInterruptHandle
for vCPU thread management. Added methods for setting the interrupt handle and interrupting vCPU execution. Updated tests to reflect these changes. [1] [2] [3] [4]src/hyperlight_host/src/hypervisor/gdb/mod.rs
: Refactoredcreate_gdb_thread
to handle the newInterruptHandle
mechanism and updated the communication protocol for initializing the debugger. [1] [2]Documentation updates:
docs/how-to-debug-a-hyperlight-guest.md
: Updated documentation to reflect support for debugging on Windows and clarified the removal ofKVM
andMSHV
guest-specific mentions. [1] [2]These changes collectively enhance the flexibility of Hyperlight's debugging capabilities, making it more robust and suitable for cross-platform use.